<template>
  <div class="section_common">
    <div class="title">目前在招岗位</div>
    <div class="search_input">
      <el-col :span="18">
      <el-input
              placeholder="请输入查询岗位"
              size="mini"
              prefix-icon="el-icon-search"
              v-model="posKeyword">
      </el-input>
      </el-col>
<!--        <el-input
              v-model="posKeyword"
              size="mini"
              placeholder="请输入查询岗位"
      ></el-input>-->
      <el-button size="mini" type="primary" @click="getExecutionList">搜索</el-button>
    </div>
    <div class="main">
      <div class="item" v-for="(item,index) in executionList" :key="index">
        <div class="dpet">部门：{{item.deptName}}</div>
        <div class="name">岗位：{{item.positionName}}</div>
        <!--<div class="needs">需求：招聘{{ item.total_num }}人，已招{{ item.alr_num }}人</div>-->
        <div class="controller">
          <el-button size="mini" type="primary" @click="getPushDetail(item.did,item.pid,item.deptName,item.positionName)">我要内推</el-button>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {

  data() {
    return {
      userId: '',
      posKeyword:'',
      title: "内推职位",
      title1:"目前在招岗位",
      finished: false,
      loading: false,
      executionList: [],
      executionListUrl: '/mobiles/executionList',
      current: 1,

    };
  },
  created() {
    this.userId = JSON.parse(localStorage.getItem('userInfo')).userId;
    this.getExecutionList();
  },
  methods:{
    getExecutionList() {
      this.$https.post(this.executionListUrl, {
        userId:this.userId,
        posKeyword:this.posKeyword
        /*current: this.current,//当前页码
        size: 10, //一次加载10条*/
      }).then((res) => {
        this.executionList=[];
        for (var i = 0; i < res.data.data.length; i++) {
          this.executionList.push(res.data.data[i]);
        }
        /*this.loading = false;
        this.current = res.data.data.current + 1;//当前页码
        if (this.executionList.length >= res.data.data.total) {
          this.finished = true;
        }*/
      }).catch(err => {
        console.log(err);
      });
    },

    //异步加载
    /*onLoad() {
      // 异步更新数据
      // setTimeout 仅做示例，真实场景中一般为 ajax 请求
      setTimeout(() => {
        this.getExecutionList();
      }, 300);
      // 数据全部加载完成
    },*/

    getPushDetail(did,pid,deptName,posName){
      this.$router.push({path: "/recruitment/internal_push/" + did+"/"+pid+"/"+deptName+"/"+posName});
    }
  }

};
</script>

<style lang="scss" scoped>
  .search_input,
  .select_area {
    margin-top: 20px;
    margin-left: 20px;
    margin-bottom: 20px;
  }
  .search_input{
    display: flex;
    flex-flow: row nowrap;
    justify-items: center;
  }
.section_common {
  // background-color: white;
  display: flex;
  flex-flow: column nowrap;
  align-items: center;
  .title {
    width: 100%;
    text-align: center;
    font-size: 20px;
    font-weight: 600;
  }
  .main {
    width: 100%;
    padding: 10px;
    display: flex;
    flex-flow: column nowrap;
    .item {
      margin-bottom: 5px;
      padding: 0 0 5px;
      border-bottom: 1px solid rgba(0, 0, 0, 0.1);
      font-size: 16px;
      & > div {
        margin-bottom: 5px;
      }
    }
  }
}
</style>